<?php
require_once(dirname(__FILE__)."/../lib/Loader.php");
cload("Smarty.smartyRenderer");
cload("database.dbquery");
cload("requestProcessor");

/**
 * Класс вывода списка шаблонов
 *
 * @author Di_Moon
 */
class distrTplList extends smartyRenderer {
    protected $_dbh;
    protected $_template = "distrTplList.tpl";
    
    function __construct($dbh) {
        parent::__construct();
        $this->_dbh = $dbh;
        $this->assign("distrid", requestProcessor::getVar("distrid"));
    }
    
    function render() {
        $sql = new dbquery($this->_dbh);
        $sql->select()->from("templateData")->where("tpl_for=2");
        $sth = $this->_dbh->query($sql);
        
        $tplList = array();
        while($fa = $this->_dbh->raw_fetch_array($sth)) {
            $row = new object($fa);
            array_push($tplList, $row->getElements());
        }
        
        $this->assign("tplList", $tplList);
        
        return $this->fetch($this->_template);
    }
}

?>
